package org.gnyxy.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.gnyxy.entity.User;

import java.util.Map;

@Mapper
public interface UserMapper {
    @Select("select * from user where openid = #{openId} and deleted = 0")
    User getByOpenId(String openId);

    @Insert("insert into user (openid, name, phone, user_points, sex, id_number, avater, create_time, deleted) "+
    "values (#{openid},#{name},#{phone},#{userPoints},#{sex},#{idNumber},#{avater},#{createTime},#{deleted})")
    void insert(User user);

    void update(User user);

    @Select("select * from user where deleted = 0 and id = #{id}")
    User getById(Long id);

    Integer countByMap(Map map);
}
